#pragma once

#include "nml_intf/zuc.hh"
#include "rcs.hh"
#include "cmd_msg.hh"
#include "stat_msg.hh"
/**
 * @brief ZUC_AXIS_STAT 单轴状态数据
 */
class ZUC_AXIS_STAT
{
public:
    ZUC_AXIS_STAT() {}
    virtual void update(CMS* cms) final;
    int axisid;
};

/**
 * @brief ZUC_AXIS_CMDITF 单轴指令数据接口类,所有单轴指令类都继承自此类并实现update_param方法
 */
class ZUC_AXIS_CMDITF : public RCS_CMD_MSG
{
public:
    ZUC_AXIS_CMDITF(NMLTYPE t, long sz) : RCS_CMD_MSG(t, sz) { axisid = 0; }
    virtual void update(CMS* cms) final;
    virtual void update_param(CMS* cms) = 0;
    int axisid;
};

class ZUC_AXIS_POWER : public ZUC_AXIS_CMDITF
{
public:
    ZUC_AXIS_POWER() : ZUC_AXIS_CMDITF(ZUC_AXIS_CMD_POWER_TYPE, sizeof(ZUC_AXIS_POWER)) {}

    void update_param(CMS* cms);

    bool enable;
};

class ZUC_AXIS_RESET : public ZUC_AXIS_CMDITF
{
public:
    ZUC_AXIS_RESET() : ZUC_AXIS_CMDITF(ZUC_AXIS_CMD_POWER_TYPE, sizeof(ZUC_AXIS_RESET)) {}

    void update_param(CMS* cms) {}
};

class ZUC_JOINT_CMD_MSG : public RCS_CMD_MSG
{
public:
    ZUC_JOINT_CMD_MSG(NMLTYPE t, size_t s) : RCS_CMD_MSG(t, s){};

    // For internal NML/CMS use only.
    void update(CMS* cms);
    int robot_id;
    int joint;
};
class ZUC_JOINT_SET_MIN_POSITION_LIMIT : public ZUC_JOINT_CMD_MSG
{
public:
    ZUC_JOINT_SET_MIN_POSITION_LIMIT() : ZUC_JOINT_CMD_MSG(ZUC_JOINT_SET_MIN_POSITION_LIMIT_TYPE, sizeof(ZUC_JOINT_SET_MIN_POSITION_LIMIT)){};

    // For internal NML/CMS use only.
    void update(CMS* cms);

    double limit;
};
class ZUC_JOINT_SET_MAX_POSITION_LIMIT : public ZUC_JOINT_CMD_MSG
{
public:
    ZUC_JOINT_SET_MAX_POSITION_LIMIT() : ZUC_JOINT_CMD_MSG(ZUC_JOINT_SET_MAX_POSITION_LIMIT_TYPE, sizeof(ZUC_JOINT_SET_MAX_POSITION_LIMIT)){};

    // For internal NML/CMS use only.
    void update(CMS* cms);

    double limit;
};
